const exApp = require("../index");
const multer = require("multer");
let files = [];
const storage = multer.diskStorage({
  //存储的位置
  destination(req, file, cb) {
    cb(null, "./uploads");
  },
  filename(req, file, cb) {
    console.log(file);
    cb(null, file.originalname);
  },
});
const upload = multer({
  storage,
});
// console.log(upload);
exApp.post("/addimg", upload.single("file"), (req, res, next) => {
  // 接收formData中的参数
  console.log(req);
  // console.log(req.fields);
  // console.log(storage, upload);
  console.log(req.file);
  // const url = "http://localhost:4000/uploads/" + req.file.filename;
  // res.json({ url });
  // 接收formData中的文件
  // req.files
});
